#define DEBUG
#include <cstdio>

using namespace std;

const int inf=0x7ffffff;

int min(int a, int b) {
  return a<b ? a : b;
}

int sqr(int a) {
  return a*a;
}

int main() {
  freopen("math.in", "r", stdin);
  freopen("math_bf.out", "w", stdout);

  int x1, x2, y1, y2;
  for (; scanf("%d %d %d %d", &x1, &y1, &x2, &y2)!=EOF; ) {
    int ans=inf;
    for (int i=-30; i<=30; i++) {
      for (int j=-30; j<=30; j++) {
	if (i!=0 || j!=0) {
	  ans = min(ans, sqr(i*x1+j*x2)+sqr(i*y1+j*y2));
	}
      }
    }
    printf("%d\n", ans);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
